package com.sky.mapper;

import com.github.pagehelper.Page;
import com.sky.annotation.AutoFile;
import com.sky.dto.SetmealPageQueryDTO;
import com.sky.entity.Setmeal;
import com.sky.entity.SetmealDish;
import com.sky.entity.ShoppingCart;
import com.sky.enumeration.OperationType;
import com.sky.vo.SetmealVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@Mapper
public interface SetmealMapper {
    /**
     * 根据分类id查询套餐的数量
     * @param id
     * @return
     */
    @Select("select count(id) from setmeal where category_id = #{categoryId}")
    Integer countByCategoryId(Long id);

    @AutoFile(OperationType.INSERT)
    void save(Setmeal setmeal);

    Page<SetmealVO> page(SetmealPageQueryDTO setmealPageQueryDTO);

    List<Setmeal> getById(List<Long> ids);

    void deleteById(List<Long> ids);

    @AutoFile(OperationType.UPDATE)
    void update(Setmeal setmeal);


    Setmeal getSetmealById(Long id);

    List<Setmeal> list(Setmeal setmeal);

    List<SetmealVO> getDishItemBySetmealId(Long setmealId);


    Integer countStatus(Integer status);
}
